package at.ac.tuwien.infosys.aic11.legacy;

import at.ac.tuwien.infosys.aic11.dto.InternalCustomer;
import at.ac.tuwien.infosys.aic11.dto.Rating;

/**
 * Created by IntelliJ IDEA.
 * User: gh
 * Date: 24.10.11
 * Time: 20:59
 * To change this template use File | Settings | File Templates.
 */
public class RatingMock {
	
	public static Rating getCustomerRating(InternalCustomer c){
	
		Rating r = new Rating();
		int length = c.getLastName().length();
		if(length<=1){
			r.setRating("AAA");
		} else if(length<=2){
			r.setRating("AAPlus");
		} else if(length<=3){
			r.setRating("AA");
		} else if(length<=4){
			r.setRating("AAMinus");
		} else if(length<=5){
			r.setRating("APlus");
		} else if(length<=6){
			r.setRating("A");
		} else {
			r.setRating("AMinus");
		}
		return r;
	}

	public static Rating getCustomerRating(String lastName){
		InternalCustomer ic = new InternalCustomer();
		ic.setLastName(lastName);
		return getCustomerRating(ic);
	}
}
